package library.operation.impl;

import library.book.BookList;
import library.operation.IOperation;

/**
 * 更新书籍操作
 */
public class UpateOperation implements IOperation {

    @Override
    public void work(BookList bookList) {
        System.out.println("此时您正在进行的是更新书籍操作");
        System.out.println("请输入您要更新的书籍名称:");
        String booksName=scanner.next();

        if (bookList.isContains(booksName)){
            System.out.println("请输入修改后的价格:");
            double price=scanner.nextDouble();
            System.out.println("请输入修改后的类别:");
            String type=scanner.next();
            bookList.booksUpate(booksName,type,price);
            System.out.println("书籍价格和类型修改成功~~");
        }else{
            System.out.println("该书不存在~~");
        }
    }
}
